package org.tnc.budget.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Proxy;

/**
 * AttachmentTable entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "attachment_table", catalog = "tnc")
public class AttachmentTable implements java.io.Serializable {

	// Fields

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="aid")
	private Integer id;
	
	@ManyToOne
	@JoinColumn(name="etid", nullable=true)
	private EventTable eventTable;
	
	@Column(name="src_name")
	private String sourceName;
	
	@Column(name="change_name")
	private String changeName;
	
	@Column(name="file_uri")
	private String fileUri;

	// Constructors

	/** default constructor */
	public AttachmentTable() {
	}

	public AttachmentTable(AttachmentTable attachmentTable){
		this.eventTable = attachmentTable.getEventTable();
		this.sourceName = attachmentTable.getSourceName();
		this.changeName = attachmentTable.getChangeName();
		this.fileUri = attachmentTable.getFileUri();
	}
	/** minimal constructor */
	public AttachmentTable(EventTable eventTable) {
		this.eventTable = eventTable;
	}

	/** full constructor */
	public AttachmentTable(EventTable eventTable, String sourceName,
			String changeName, String fileUri) {
		this.eventTable = eventTable;
		this.sourceName = sourceName;
		this.changeName = changeName;
		this.fileUri = fileUri;
	}

	// Property accessors
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public EventTable getEventTable() {
		return this.eventTable;
	}

	public void setEventTable(EventTable eventTable) {
		this.eventTable = eventTable;
	}

	public String getSourceName() {
		return this.sourceName;
	}

	public void setSourceName(String sourceName) {
		if (sourceName != null)
			this.sourceName = sourceName;
		else
			this.sourceName = "";
	}

	public String getChangeName() {
		return this.changeName;
	}

	public void setChangeName(String changeName) {
		if (changeName != null)
			this.changeName = changeName;
		else
			this.changeName = "";
	}

	public String getFileUri() {
		return this.fileUri;
	}

	public void setFileUri(String fileUri) {
		this.fileUri = fileUri;
	}

}